"""
@name : 11-19  countIP
@author : hj
@projectname: CJH
"""
import random

fp = open("ips.txt", "a+")
for i in range(12000):
    fp.write(f"172.25.254.{random.randint(1, 255)}" + "\n")
fp.close()

fp = open("ips.txt", "r")
dic = {}
lst = fp.readlines()
for key in lst:
    dic.update({key: lst.count(key)})

new_lst = sorted(dic.items(), key=lambda kv: kv[1], reverse=True)
print([i for i in new_lst[:10]])


fp.close()